package ACWing.mathematicalknowledge.质数;
//866. 试除法判定质数

import java.util.Scanner;

/**
 * @author :chenjie
 * @date :Created 2023/1/9 19:42
 */
public class PrimeNumbersDeterminedTrialDivision {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for (int i = 0; i < n; i++) {
            int x=sc.nextInt();
            if (isPrime(x)) {
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
        }
    }
    public static boolean isPrime(int x){
        if(x<2){
            return false;
        }
        for (int i = 2; i <= x/i; i++) {
            if(x%i==0){
                return false;
            }
        }
        return true;
    }
}
